#ifndef FIREBOX_ENTITY_H
#define FIREBOX_ENTITY_H 

#include "IEntity.h"
#include "IUpdater.h"
#include <hash_map>
#include "BaseDefs.h"
#include "IProperty.h"

//////////////////////////////////////////////////////////////////////////
/////////////             2014/10/02                        //////////////
//////////////////////////////////////////////////////////////////////////
namespace steam
{
	namespace firebox
	{
		class Entity : public base::IEntity
		{
		public:
			Entity();
			template<typename T> T* const  getProperty();
			~Entity();

			virtual ID getId() const;

		protected:
		private:
			base::IPropertiesMap m_propertyMap;
		};

		template<typename T>
		T* const Entity::getProperty() 
		{
			const TypeID& type = T::getIDStatic();
			_ASSERT(type != steam::INVALID_TYPE_ID);
			base::IPropertiesMap::const_iterator it = m_propertyMap.find(type);
			if (it != m_propertyMap.end())
			{
				return static_cast<T*>(it->second);
			}
			T* t = new T();
			m_propertyMap[type] = t;
			return t;
		}

	}
}

#endif 